<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:outputStylesheet library="css" name="main.css" />
    <h:head>
        <title>Welcome to DelayChecker</title>        
    </h:head>
    <h:body>           
        <ui:composition template="WEB-INF/facelets/template.xhtml">  
        <ui:define name="content">  
        <div class="main">
            <h:form>
                <h:outputLabel value="Skriv in datum:"/>
                <h:inputText id="startInput" value="#{searchBean.startDate}" />
                <h:commandButton value="Sök resor" action="#{searchBean.findJourneys}" />           

            <br/><br/>
            <h:dataTable id="journeyTable" value="#{searchBean.journeys}" var="departure" styleClass="journeyTable">  

                    <h:column>  
                        <f:facet name="header">
                            <h:outputLabel value="Linje"/>
                        </f:facet>
                        <h:outputLabel value="#{departure.line}"/>
                    </h:column> 

                    <h:column>  
                         <f:facet name="header">
                            <h:outputLabel value="Riktning"/>
                        </f:facet>
                        <h:outputLabel value="#{departure.direction}"/>
                    </h:column> 

                    <h:column>  
                        <f:facet name="header">
                            <h:outputLabel value="Starttid"/>
                        </f:facet>
                        <h:commandLink value="#{departure.startTimeString}" action="#{journeyBean.viewJourney}">
                            <f:setPropertyActionListener target="#{journeyBean.selectedJourney}" value="#{departure}" />
                        </h:commandLink>
                    </h:column> 


            </h:dataTable>
            </h:form>
        </div>
        </ui:define>
        </ui:composition>
    </h:body>
</html>